import com.opal.modules.costReportForm.entity.CostReport;
import com.opal.modules.costReportForm.service.impl.CostReportServiceImpl;
import org.aspectj.weaver.ast.Var;

import java.io.Console;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Demo{
    public static void aa(){
        StringBuilder sb= new StringBuilder();
        sb.append(",");
        sb.append("101");
        sb.append(",");
        sb.append("102");

        System.out.println( sb.toString());
    }

    //主方法
    public static void main(String[] args) throws IOException {
        aa();
//        CostReportServiceImpl costReportService =new CostReportServiceImpl();
//        CostReport costReport =new CostReport();
//        costReport.setFinishedProductCode("W521007843");
//        costReport.setFinishedProductCode2(";,,,W521007871~W521007880,W521007978,W521007979");  //W561000585W561000586W561000587W561000588W561000589W561000590W561000591
//        costReportService.processingFinishedProductCodeData(costReport);
//
//        System.out.println(costReport.getFinishedProductCode3());

    }
    //W521007856，W521007871,W521007872,W521007880,W521007978,W521007979

    //io流
    public void srsw(){
        String  str = "从今天起，做一个幸福的人，\n喂马，劈材，周游世界，\n从明天起，关心粮食和蔬菜，\n我有一所房子，面朝大海，春暖花开，\n从明天起，和每一个人通信，告诉他们我的幸福,\n从明天起，看书，练字，孝敬父母亲人！！！";
        char[] ch = new  char[1024];
        int a = 0;
        String s;
        StringReader sr = new StringReader(str);//创建一个新的字符串 实例化出 StringReader 对象
        StringWriter sw = new StringWriter();
        try {
            while ((a=sr.read(ch))>0) {   //循环读入
                s = new String(ch,0,a);
                System.out.println(s+"StringRead input");//  读一段就在控制台打印一段

                sw.write(s);//上面你读一段 我就在往StringWriter 里面写一段
                System.out.println(sw.toString()+"StringWriter input");//我也在 控制台打印一段

                sw.append(s);//与write() 方法的区别 append 效率高一点
                System.out.println(sw.toString()+"StringWriter append()");
            }
        } catch (IOException  e) {
            e.printStackTrace();
        }
        //当循环完了   我也  打印输出一下
        System.out.println(sw.toString()+"StringWriter input all");
    }
}
class EcanSecurity {

    /// <summary>
    /// 简单加密函数
    /// </summary>
    /// <param name="str">要加密的字符串</param>
    /// <returns>返回加密后的字符串</returns>
    ///
    public static String simple_Encode(String str){
        String s = "";
        try{
            char[] chars= str.toCharArray();
            for (int i = 0; i < chars.length; i++){
                s += (char)(chars[i] + 10 - 1 * 2);
            }
            return s;
        }catch (Exception e){
            return str;
        }
    }

    /// <summary>
    /// 简单解密函数
    /// </summary>
    /// <param name="str">要解密的字符串</param>
    /// <returns>返回解密后的字符串</returns>
    ///
    public static String simple_Decode(String str){
        String s = "";
        try{
            char[] chars= str.toCharArray();
            for (int i = 0; i < chars.length; i++){
                s += (char)(chars[i] - 10 + 1 * 2);
            }
            return s;
        }catch (Exception e){
            return str;
        }
    }
}



